package com.zenith.common.base;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author 22071
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(name = "BaseEntity", description = "基础实体类，包含创建时间、更新时间、逻辑删除字段")
public class BaseEntity {
    @Schema(description = "id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    @Schema(description = "创建人id")
    private Long createBy;

    @Schema(description = "更新人id")
    private Long updateBy;

    @Schema(description = "逻辑删除")
    private Integer isDelete;

    @Schema(description = "版本号")
    private Integer version;
}